package model;

import java.util.ArrayList;

public class JsonPack
{

	public static String convertToOneJsonStr(String[] names, String[] values, int num)
	{
		/*
		String jsonStr = "{";
		for (int i = 0; i < num; i++)
		{
			jsonStr += "\"" + names[i] + "\":\"" + values[i] + "\",";
		}
		jsonStr.deleteCharAt(jsonStr.length() - 1);

		jsonStr += "}";

		return jsonStr;
		*/
		return null;
	}

	public static String userListPackJson(ArrayList<User> users)
	{
		StringBuffer sb = new StringBuffer();
		
        sb.append('[');
		
		for (User user : users)
		{

			sb.append('{').append("\"phoneNumber\":").append("\"" + user.getPhoneNumber() + "\"").append(",");
			sb.append("\"name\":").append("\"" + user.getName() + "\"");

			sb.append('}').append(",");

		}

		if(users.size()>0)
		{
			sb.deleteCharAt(sb.length() - 1);
		}
		

		sb.append(']');
		
		return new String(sb);
	}

}
